//
// Created by 11510 on 2024/6/17.
//
#include <iostream>
using namespace std;

class A{
public:
    void print() const{
        cout << "A::print()" << endl;
    }
    double _a;
};
class B: virtual public A{
public:
    double _b;
};

class C: virtual public A{
public:
    double _c;
};

class D: public B, public C{
public:
    double _d;

};

void test0(){
    D d;
    printf("size B = %ld\n", sizeof(B));
    printf("size C = %ld\n", sizeof(C));
    printf("size D = %ld\n", sizeof d);
//    此时D中只存在一份A对象
//    d.print();
}

int main(){
    test0();
}
